package com.belly.office;

import com.actionbarsherlock.app.SherlockActivity;

import android.app.Activity;
import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.util.Log;

public class BaseActivity extends SherlockActivity {

	
	
	

	 public boolean isNetworkAvailable(Context context)
	    {
	        ConnectivityManager connectivity = (ConnectivityManager) context
	        .getSystemService(Context.CONNECTIVITY_SERVICE);

	        if (connectivity != null) {

	            NetworkInfo[] info = connectivity.getAllNetworkInfo();

	            if (info != null) {

	                for (int i = 0; i < info.length; i++) {

	                    Log.w("INTERNET:", String.valueOf(i));

	                    if (info[i].getState() == NetworkInfo.State.CONNECTED) {

	                        Log.w("INTERNET:", "connected!");

	                        return true;

	                    }

	                }

	            }

	        }

	        return false;

	    }

}
